package com.lsy.on_line.zaixian.mapper;

import com.lsy.on_line.zaixian.model.entity.User;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author ShiYuan
 * @since 2022-07-24
 */
public interface UserMapper extends BaseMapper<User> {

    /**
     * 根据手机号判断用户是否已存在
     * @return
     */
    User findByPhone(@Param("phone") String phone);

    /**
     * 注册：新增用户信息
     * @return
     */
    int save(User user);

    /**
     * 登录
     * @param phone
     * @param md5
     * @return
     */
    User findByPhoneAndPwd(@Param("phone") String phone,@Param("pwd") String md5);

    /**
     * 根据id查询用户信息
     * @param userId
     * @return
     */
    User findByToken(Integer userId);
}
